package com.henu.engineer.dao.mapper.student

import com.henu.engineer.dao.entity.student.StudentCourseAchieved
import org.apache.ibatis.annotations.Mapper
import org.springframework.stereotype.Repository

/**
 * 学生课程目标总达成度表
 *
 * @author noexcept
 * @date 2021/8/4 22:41
 */
@Mapper
@Repository
interface StudentCourseAchievedXmlMapper {
    fun insertSingle(studentId: String, courseId: String, achievedScale: Double, semester: String): Boolean

    /**
     * @param studentCourseAchievedList 对象的各个字段都不能为空
     * @return 影响行数
     */
    fun insertList(studentCourseAchievedList: List<StudentCourseAchieved>): Int
    fun deleteSingle(studentId: String, courseId: String): Boolean

    /**
     * 删除同一课程的多个学生达成度
     */
    fun deleteList(courseId: String, studentIds: List<String>): Int
    fun updateAchieveScale(studentId: String, courseId: String, achievedScale: Double): Boolean
    fun selectAchieveScale(studentId: String, courseId: String): Double?

    /**
     * 查询某个学生所有课程的达成度
     */
    fun selectListByStudentId(studentId: String): List<StudentCourseAchieved>

    /**
     * 查询某课程所有学上的达成度
     */
    fun selectListByCourseId(courseId: String): List<StudentCourseAchieved>
}